﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using control.Biz;

namespace TrangSucShop.usercontrol
{
    public partial class newprod : System.Web.UI.UserControl
    {
        //gang thuoc tinh so cot de tuy y chinh sua
        private int soCot;
        public int SoCot
        {
            get 
            {
                return soCot; 
            }
            set { soCot = value; }
        }
        //thuoc tinh tieu de tuy chinh
        private string title;
        public string Title
        {
            set { title = value; }
            get 
            {
                if (title == null)
                    title = "No Title";
                return title; 
            }
        }
        //thuoc tinh so san pham tuy chinh
        private int soSp;
        public int SoSp
        {
            get 
            {
                if (soSp == null)
                    soSp = int.MaxValue;
                return soSp; 
            }
            set { soSp = value; }
        }
       
        private List<BizSanPham> datasource;
        public List<BizSanPham> Datasource
        {
            get
            {
                if (datasource == null)
                {
                    datasource = new List<BizSanPham>();
                }
                return datasource;
            }
            set { datasource = value; }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Lbtitle.Text = Title;//gang title cho label
            //List<BizSanPham> newsps = new List<BizSanPham>();
            //newsps = BizSanPham.GetNewSp(); minh da co datasource roi nen bo~ 2 dong nay de thay bang datasource
            PagedDataSource _pageDataSource = new PagedDataSource();
            _pageDataSource.DataSource = datasource;
            _pageDataSource.PageSize = SoSp;//gang so sp muon hien thi
            _pageDataSource.AllowPaging = true;
            DataList1.DataSource = _pageDataSource;
            DataList1.RepeatColumns = soCot;//gang so cot cho datalist
            DataList1.DataBind();
        }
        protected string Urlicon()
        {

                return "images/new_icon.gif";//url hinh new product

        }

    }
}